﻿using System;

namespace Mads.CoreDomain
{
  /// <summary>
  /// Price of the ticket (dependant on start and end stations).
  /// </summary>
  public class TicketPrice : VersionedKeyAbstraction
  {
    /// <summary>
    /// Destination station of the ticket.
    /// </summary>
    public Station StartStation { get; set; }

    /// <summary>
    /// Arrival station of the ticket.
    /// </summary>
    public Station EndStation { get; set; }

    /// <summary>
    /// Ticket price in roubles.
    /// </summary>
    public float Price { get; set; }

    public TicketPrice(Station startStaion, Station endStation, float price)
    {
      if (startStaion == null)
      {
        throw new ArgumentNullException("startStation");
      }
      if (endStation == null)
      {
        throw new ArgumentNullException("endStation");
      }
      if (price <= 0)
      {
        throw new ArgumentException("price");
      }

      StartStation = startStaion;
      EndStation = endStation;
      Price = price;
    }
  }
}